# -*- coding=utf-8-*-
"""
@File:memory_selection
@Author:Created by Han X.Y
@Date:on 2021/7/23 17:52 
"""


def func(x):
    tmp = []
    i = 0
    max_len = 0
    while i < len(x):
        if len(tmp) == 0:
            tmp.append(x[i])
        elif x[i] - tmp[-1] == 1 and x[i] not in tmp:
            tmp.append(x[i])
        else:
            tmp = [x[i]]
        max_len = len(tmp) if len(tmp) > max_len else max_len
        print(f'i={i},max_len={max_len},x[i]={x[i]},tmp={tmp}')
        i += 1
    return max_len